import { Controller, Get, Next, Post, Req, Res } from '@nestjs/common';
import { NextFunction, Request, Response } from 'express';
import { AppService } from './app.service';

@Controller('/upload')
export class AppController {
  constructor(private readonly appService: AppService) {}

  @Post('/:filename')
  upload(
    @Req() req: Request,
    @Res() res: Response,
    @Next() next: NextFunction,
  ) {
    return this.appService.handleUpload(req, res, next);
  }

  @Get('/merge/:filename')
  merge(@Req() req: Request, @Res() res: Response, @Next() next: NextFunction) {
    return this.appService.handleMergeChunks(req, res, next);
  }

  @Get('/verify/:filename')
  verify() {
    return this.appService.verify();
  }
}
